#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import requests
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("114.114.114.114", 80))
ip = s.getsockname()[0]
hostName = socket.gethostname()
token = '0794c2ed2e574974bcdd4cc3b501db89'
title = '{}的消息'.format(hostName)  # 改成你要的标题内容
content = '内网地址：{}'.format(ip)  # 改成你要的正文内容
url = 'http://www.pushplus.plus/send'
data = {
    "token": token,
    "title": title,
    "content": content
}
body = json.dumps(data).encode(encoding='utf-8')
headers = {'Content-Type': 'application/json'}
requests.post(url, data=body, headers=headers)